package org.tinygroup.httpchannel;

import org.tinygroup.cepcore.CEPCore;
import org.tinygroup.context.Context;
import org.tinygroup.context.util.ContextFactory;
import org.tinygroup.event.Event;
import org.tinygroup.test.service.HelloService;

public class BizOperator {
    //org.tinygroup.cepcore.CEPCore
    CEPCore core;
    public CEPCore getCore() {
        return core;
    }
    public void setCore(CEPCore core) {
        this.core = core;
    }
    //
    // 其他代码
    //

    public void deal(){
        //org.tinygroup.context.Context
        Context context = ContextFactory.getContext();
        context.put("abc", "123456");//此处的key为服务发布方发布出来的服务的参数name值
        context.put("def",654321);
        Event event = Event.createEvent("org.tinygroup.test.service.HelloService.start", context);
        core.process(event); // 此处的CEPCore对象就是前面获取的，实际调用中，建议由框架统一封装这个方法，有开发者去掉用这个封装
        String str = event.getServiceRequest().getContext().get("result");
        System.out.println(str);
    }
}
